package response

import (
	layModel "zsc-boot/app/system_layer/model"
)

type CustomerCount struct {
	IsNew bool  `json:"isNew" gorm:"column:is_new;comment:是否为新数据;default:true"`
	Count int64 `json:"count" gorm:"column:count;default:0"`
}

type OrderByDate struct {
	Date  string `json:"date" gorm:"column:date;"`
	Count int64  `json:"count" gorm:"column:count;default:0"`
}

type OrderByDep struct {
	DepId   uint   `json:"depId" gorm:"column:dep_id;"`
	DepName string `json:"depName"`
	Count   int64  `json:"count" gorm:"column:count;default:0"`
}

type UserRanking struct {
	UserId     uint       `json:"userId" gorm:"column:user_id;"`
	Count      int64      `json:"count" gorm:"column:count;default:0"`
	UserSimple UserSimple `json:"userSimple" gorm:"foreignKey:UserId;"`
}

type ChannelConversion struct {
	ChannelId     uint          `json:"channelId" gorm:"column:channel_id;"`
	ChannelInfo   ChannelSimple `json:"channelInfo" gorm:"foreignKey:ChannelId;"`
	CustomerCount int64         `json:"customerCount" gorm:"column:customer_count;"`
	OrderCount    int64         `json:"orderCount" gorm:"column:order_count;"`
}

type ChannelSimple struct {
	ID   uint   `json:"Id" form:"Id" gorm:"column:id;primaryKey;comment:主键ID"` // 主键ID
	Name string `gorm:"column:name" json:"name"`
}

func (ChannelSimple) TableName() string {
	return "customer_channel"
}

type UserSimple struct {
	ID   uint   `json:"Id" form:"Id" gorm:"column:id;primaryKey;comment:主键ID"` // 主键ID
	Name string `gorm:"column:name" json:"name"`
}

func (UserSimple) TableName() string {
	return "service_user"
}

// CustomerLevelGroup 客户星级汇总
type CustomerLevelGroup struct {
	Level string `json:"level"`
	Count int64  `json:"count"`
}

type CustomerFirstUserGroup struct {
	FirstUserId uint       `json:"firstUserId" gorm:"column:first_user_id;"`
	Count       uint       `json:"count" gorm:"column:count;default:0"`
	UserSimple  UserSimple `json:"userSimple" gorm:"foreignKey:FirstUserId;"`
}

type ChannelReportRes struct {
	ChannelId          uint          `json:"channelId" gorm:"column:channel_id;"`
	ChannelInfo        ChannelSimple `json:"channelInfo" gorm:"foreignKey:ChannelId;"`
	CustomerCount      int64         `json:"customerCount" gorm:"column:customer_count;"`
	TwoLevel           uint          `json:"twoLevel" gorm:"column:two_level;"`
	OrderCount         int64         `json:"orderCount" gorm:"column:order_count;"`
	OrderMoneyCount    int64         `json:"orderMoneyCount" gorm:"column:order_money_count;"`
	OrderAddMoneyCount int64         `json:"orderAddMoneyCount"`
}

type UserReportRes struct {
	UserId             uint                       `json:"userId" gorm:"column:user_id;"`
	UserInfo           layModel.ServiceUserSimple `json:"UserInfo" gorm:"foreignKey:UserId;"`
	CustomerCount      int64                      `json:"customerCount" gorm:"column:customer_count;"`
	TwoLevel           uint                       `json:"twoLevel" gorm:"column:two_level;"`
	OrderCount         int64                      `json:"orderCount" gorm:"column:order_count;"`
	OrderMoneyCount    int64                      `json:"orderMoneyCount" gorm:"column:order_money_count;"`
	OrderAddMoneyCount int64                      `json:"orderAddMoneyCount"`
}

type ChannelLevelReportRes struct {
	ChannelId     uint          `json:"channelId" gorm:"column:channel_id;"`
	ChannelInfo   ChannelSimple `json:"channelInfo" gorm:"foreignKey:ChannelId;"`
	CustomerCount int64         `json:"customerCount" gorm:"column:customer_count;"`
	ZeroLevel     uint          `json:"zeroLevel"`
	OneLevel      uint          `json:"oneLevel"`
	TwoLevel      uint          `json:"twoLevel"`
}

type CustomerChannelLevel struct {
	ChannelId uint  `json:"channelId" gorm:"column:channel_id;"`
	Level     uint8 `json:"Level" gorm:"column:level;comment:星级;default:1"`
}
